package com.yanqingying.service.impl;
import com.yanqingying.Dept;
import com.yanqingying.mapper.DeptMapper;
import com.yanqingying.service.DeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Service
public class DeptServiceImpl implements DeptService {

    @Autowired
    private DeptMapper deptMapper;

    public List<Dept> list(){
        return deptMapper.list();
    }
    public void delete(Integer id){
        deptMapper.delete(id);
    }
    public void add(Dept dept){
        dept.setCreateTime(LocalDateTime.now());
        dept.setUpdateTime(LocalDateTime.now());
        deptMapper.add(dept);
    }

    public Dept infor(Integer id){
        return deptMapper.infor(id);
    }

    public void upDate(Dept dept){
        dept.setUpdateTime(LocalDateTime.now());
        deptMapper.upDate(dept);
    }
}
